{% extends "base.html" %}
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
{% load origin static ietf_filters %}
{% block pagehead %}
    <link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}References from {{ doc.name|prettystdname }}{% endblock %}
{% block content %}
    {% origin %}
    <h1>References from {{ doc.name|prettystdname }}</h1>
    <p class="my-3 alert alert-info">
        These dependencies are extracted using heuristics looking for strings with particular prefixes. Notably, this means that references to I-Ds by title only are not reflected here. If it's really important, please inspect the documents' references sections directly.
    </p>
    <p>
        <a class="btn btn-primary"
           href="{% url 'ietf.doc.views_help.relationship_help' subset='reference' %}">
            Reference type help
        </a>
    </p>
    <table class="table table-sm table-striped tablesorter">
        <thead>
            <tr>
                <th scope="col" data-sort="document">Document</th>
                <th scope="col" data-sort="title">Title</th>
                <th scope="col" data-sort="status">Status</th>
                <th scope="col" data-sort="type">Type</th>
                <th scope="col" data-sort="downref">Downref</th>
            </tr>
        </thead>
        <tbody>
            {% for ref in refs %}
                {% with ref.target.name as name %}
                    <tr>
                        <td>
                            <a href="{% url 'ietf.doc.views_doc.document_main' name=name %}">{{ name|prettystdname }}</a>
                        </td>
                        <td>
                            <b>{{ ref.target.title }}</b>
                            <br>
                            <a class="btn btn-primary btn-sm"
                               href="{% url 'ietf.doc.views_doc.document_references' name %}"
                               rel="nofollow">
                                <i class="bi bi-arrow-left"></i>
                                References
                            </a>
                            <a class="btn btn-primary btn-sm"
                               href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}"
                               rel="nofollow">
                                <i class="bi bi-arrow-right"></i>
                                Referenced by
                            </a>
                        </td>
                        <td>
                            {% if ref.target.type_id == "rfc" %}
                                {% with ref.target.std_level as lvl %}
                                    {% if lvl %}{{ lvl }}{% endif %}
                                {% endwith %}
                            {% else %}
                                {% with ref.target.intended_std_level as lvl %}
                                    {% if lvl %}{{ lvl }}{% endif %}
                                {% endwith %}
                            {% endif %}
                        </td>
                        <td>{{ ref.relationship.name }}</td>
                        <td>{{ ref.is_downref|default:'' }}</td>
                    </tr>
                {% endwith %}
            {% endfor %}
        </tbody>
        </table>
    {% endblock %}
    {% block js %}
        <script src="{% static "ietf/js/list.js" %}"></script>
    {% endblock %}
